﻿<UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  x:Class="MyFloridaHouse.SilverlightMassDataReport.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="600" d:DesignWidth="800">

    <!---->

    <Grid  x:Name="LayoutRoot" Margin="2"   Background="{StaticResource MainPageBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

    <StackPanel  Grid.Row="0"  Orientation="Horizontal" VerticalAlignment="Center">
        <sdk:Label Content="Florida House of Representatives   "  Style="{StaticResource lblTitleStyle}" ></sdk:Label>
        <sdk:Label Content="MyDistrictBuilder(TM)   "  Style="{StaticResource lblTitleStyle}" ></sdk:Label>
        <sdk:Label Content="Data Explorer"  Style="{StaticResource lblTitleStyle}" ></sdk:Label>
        <sdk:Label Content="(Loading ACS Data Definitions)"  Background="Yellow" Visibility="{Binding isACSDefinitionLoadComplete, Converter={StaticResource ConvertNotBoolToVisibility}}" ></sdk:Label>
    </StackPanel>

    <StackPanel Grid.Row="1"  Orientation="Horizontal"  Visibility="{Binding isACSDefinitionLoadComplete, Converter={StaticResource ConvertBoolToVisibility}}">

        <StackPanel Orientation="Vertical">
            <Button    Content="Update Report" Command="{Binding  CmdACSDistrictSummary}"  Height="23"  HorizontalAlignment="Center" ToolTipService.ToolTip="Click to run report for current selections" Margin="15,5,0,5" />
            <sdk:Label Content="For District:" HorizontalAlignment="Center"/>
            <ComboBox  Height="20"  x:Name="cmbDistrict" ItemsSource="{Binding districtList}" SelectedIndex="{Binding districtSelectedIndex, Mode=TwoWay}" DropDownOpened="OnComboDistrictOpened" Tag="{Binding}"  HorizontalAlignment="Center"  >
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <sdk:Label Content="{Binding}" />
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </StackPanel>
        
            <Border BorderBrush="Black" BorderThickness="1" Margin="2" Padding="2">
        <Grid >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Plan Name: " HorizontalAlignment="Right"></TextBlock>
                    <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding planName}" Margin="0,0,10,0"></TextBlock>
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Plan Type: " HorizontalAlignment="Right"></TextBlock>
                    <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding planType}" Margin="0,0,10,0"></TextBlock>
                    <TextBlock Grid.Row="2" Grid.Column="0" Text="Plan Districts: " HorizontalAlignment="Right"></TextBlock>
                    <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding planDistrictCount}" Margin="0,0,10,0"></TextBlock>
                    <TextBlock Grid.Row="3" Grid.Column="0" Text="Plan Last Modified: " HorizontalAlignment="Right"></TextBlock>
                    <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding planLastUpdateTimeStamp}"></TextBlock>
                    <TextBlock Grid.Row="4" Grid.Column="0" Text="Report Created: "   HorizontalAlignment="Right"></TextBlock>
                    <TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding reportCreatedTimeStamp}"></TextBlock>
            </Grid>
            </Border>

            
                        


    </StackPanel>

    <Grid  Grid.Row="3" Grid.Column="0"  Visibility="{Binding isACSDefinitionLoadComplete, Converter={StaticResource ConvertBoolToVisibility}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="5"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <sdk:GridSplitter  Grid.Row="0" Grid.Column="1" VerticalAlignment="Stretch" HorizontalAlignment="Center" ToolTipService.ToolTip="Drag to adjust Report size"></sdk:GridSplitter>

        <!--<Button Content="Print" Command="{Binding  CmdFilePrint}" Width="75" Height="23" HorizontalAlignment="Left" Margin="2" ToolTipService.ToolTip="Click to print report "  />-->

    <Border  Grid.Row="0" Grid.Column="0" BorderBrush="Black" BorderThickness="2" Margin="2">

        <Grid   >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <StackPanel   Grid.Row="0" Grid.Column="0" Orientation="Vertical">
                <TextBlock  Text="ACS Data" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
                <TextBlock  Text="Topics" HorizontalAlignment="Center" VerticalAlignment="Center" ></TextBlock>
            </StackPanel>
            <sdk:TreeView     Grid.Row="1" Grid.Column="0" ItemsSource="{Binding ACSSubjectTree}" BorderThickness="2" Background="{StaticResource MainPageBackgroundBrush}" VerticalAlignment="Stretch"  Margin="2" Padding="0,0,15,0" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto">
                <sdk:TreeView.ItemTemplate>
                    <sdk:HierarchicalDataTemplate ItemsSource="{Binding subList}">
                        <StackPanel Orientation="Horizontal" >
                            <CheckBox IsChecked="{Binding isSelected, Mode=TwoWay}" />
                            <TextBlock Text="{Binding name}" Tag="{Binding}"></TextBlock>
                        </StackPanel>
                    </sdk:HierarchicalDataTemplate>
                </sdk:TreeView.ItemTemplate>
            </sdk:TreeView>

        </Grid>
    </Border>

    <Border Grid.Row="0"  Grid.Column="2" BorderBrush="Black" BorderThickness="2" Margin="2" >
            <Grid Grid.Row="2"  Margin="2"  >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <StackPanel Grid.Row="0" x:Name="ChildwindowStackpanel" ></StackPanel>
                <ListBox Grid.Row="1" Margin="0"   x:Name="appPrintArea"  ItemsSource="{Binding ACSDistrictSummaryReportSections}" 
                              Background="{StaticResource MainPageBackgroundBrush}"
                      ScrollViewer.HorizontalScrollBarVisibility="Auto"
                      ScrollViewer.VerticalScrollBarVisibility="Auto"
                        ItemTemplate="{StaticResource DataTemplateACSDistrictSummaryReport}"
                          
                      >
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Vertical"></StackPanel>
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>

                </ListBox>
            </Grid>
        </Border>
    </Grid>
    </Grid>


</UserControl>
